<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>斐波那契数列</title>
	</head>
	<body>
		<script>
			
			//除了前两个数之外， 每一个数都等于前两个数的和
			
			let n = + prompt('您要打印几项的斐波那契数列',1)
			
			let pre = 1 , prePre = 1; //pre上一项， prePre上上一项
			
			for (let i = 1; i <= n; i++) {
				
				if(i == 1 || i == 2){
					console.log(1);
				}else{
					let cur = pre + prePre;
					console.log(cur);
					prePre = pre;
					pre = cur;
				}
			}
			
			
		</script>
	</body>
</html>